Personal tools

Lua/Shared/math/clamp

From JC2-MP Documentation

< Lua‎ | Shared
Jump to: navigation, search

Returns    number
Prototype    math.clamp(number value, number min, number max)
Description    Clamps value between min and max.


Examples

for i=10,20 do
  print(i, math.clamp(i,12,17))
end
--[[
Output:
10  12
11  12
12  12
13  13
14  14
15  15
16  16
17  17
18  17
19  17
20  17
]]